<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--bootstrap插件-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="/static/plugin/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugin/jo/joUI.css" rel="stylesheet"/>
    <!--字体插件-->
    <link href="/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugin/layui-2.4.3/css/layui.css" rel="stylesheet"/>
    <!--ztree-->
    <link href="/static/plugin/zTree/css/metroStyle/metroStyle.css" rel="stylesheet"/>
    <!--common-->
    <link href="/static/css/common.css" rel="stylesheet"/>
    <title>投票主信息视图</title>
</head>
<body class="skin-default">

<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12">
            <!--视图块-->
            <div class="container-fluid card">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <!--检索栏-->
                        <form class="form-inline search-bar" id="pageForm">
                            <div class="form-group">
                                <label class="control-label">投票编号：&nbsp;</label>
                                <input type="text" name="id" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">投票标题：&nbsp;</label>
                                <input type="text" name="title" class="form-control">
                            </div>
                            <button type="button" class="btn btn-primary" onclick="joView.select()"> <i class="fa fa-search" aria-hidden="true"></i>&nbsp;查询</button>
                        </form>
                        <!--/检索栏-->
                    </div>
                </div>
                <!--<div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        &lt;!&ndash;按钮栏&ndash;&gt;
                        <div class="form-group button-bar">
                            <button isShow="" type="button" class="btn btn-primary" onclick="joView.add()">
                                <i class="fa fa-plus" aria-hidden="true"></i>&nbsp;新增
                            </button>
                            <button type="button" class="btn btn-danger" onclick="joView.del()">
                                <i class="fa fa-trash-o" aria-hidden="true"></i>&nbsp;删除
                            </button>
                            <button type="button" class="btn btn-warning" onclick="window.location.reload()">
                                <i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;刷新
                            </button>
                        </div>
                        &lt;!&ndash;/按钮栏&ndash;&gt;
                    </div>
                </div>-->
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <div class="table-bar">
                            <!--grid-->
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover" id="mainList" dataUrl="/bs/vote/voteInfo/getCanVoteList" formUrl="/page/vote/voteInfoForm.html">
                                    <!--<col field="id" title="投票信息编号" width="20%" align="" event="click" />-->
                                    <col field="title" title="标题" width="40%" align=""  />
                                    <!--<col field="content" title="内容" width="15%" align=""  />-->
                                    <col field="[=jo.formatDate('{startTime}')]" title="投票开始时间(含)" width="15%" align=""  order="startTime"/>
                                    <col field="[=jo.formatDate('{endTime}')]" title="投票结束时间(不含)" width="15%" align=""  order="endTime"/>
                                    <col field="stateName" title="状态" width="15%" align=""  order="state"/>
                                    <col field="opt" title="操作" width="15%" align="" />
                                    <!--<col field="[=jo.formatTime('{updateTime}')]" title="修改时间" width="15%" align=""  order="updateTime"/>-->
                                </table>
                            </div>
                            <!--/grid-->

                            <!--分页条-->
                            <div class="page-bar" gridId="mainList">

                            </div>
                            <!--/分页条-->
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<!--配置信息-->
<script src="/static/js/config.js"></script>
<!--jquery-->
<script src="/static/plugin/jquery/jquery-3.3.1.js"></script>
<script src="/static/plugin/jquery/jquery.cookie.js"></script>
<!--bootstrap-->
<script src="/static/plugin/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/static/plugin/other/html5shiv.js"></script>
<script src="/static/plugin/other/respond.min.js"></script>
<![endif]-->
<!--layui-->
<script src="/static/plugin/layui-2.4.3/layui.all.js"></script>
<!--ztree-->
<script src="/static/plugin/zTree/js/jquery.ztree.all.js"></script>
<!--common-->
<script src="/static/js/common.js"></script>
<!--jo-->
<script src="/static/plugin/jo/jo.js"></script>
<script src="/static/plugin/jo/jo-adapt.js"></script>
<script src="/static/plugin/jo/jo-page-view.js"></script>
<script src="/static/plugin/jo/jo-page-form.js"></script>
<script src="/static/plugin/jo/jo-listener.js"></script>
<script type="text/javascript">
    layui.laydate.render({
        elem: '#startTime' //注册日期控件
    });
    layui.laydate.render({
        elem: '#startTime2' //注册日期控件
    });
    layui.laydate.render({
        elem: '#endTime' //注册日期控件
    });
    layui.laydate.render({
        elem: '#endTime2' //注册日期控件
    });
    layui.laydate.render({
        elem: '#createTime' //注册日期控件
    });
    layui.laydate.render({
        elem: '#createTime2' //注册日期控件
    });
    layui.laydate.render({
        elem: '#updateTime' //注册日期控件
    });
    layui.laydate.render({
        elem: '#updateTime2' //注册日期控件
    });
    layui.laydate.render({
        elem: '#ts' //注册日期控件
    });
    layui.laydate.render({
        elem: '#ts2' //注册日期控件
    });
    $(function(){
        joView.init({grid:$("#mainList"),PKName:"id", checkStyle:'order'});//初始化页面
    });
    //表格渲染时行处理,参数1为当前行的数据对象,参数2为当前行的索引值(最小为0)
    joView.handleItem = function(oItem,iIndex){
        oItem.opt = '';
        if(oItem.voteResult){
            oItem.state = oItem.voteResult.state;
        }else{
            oItem.state = -1;
        }
        if(oItem.state == 1){
            oItem.stateName = '发起投票';
        }else if(oItem.state == 2){
            oItem.stateName = '管理员签名';
        }else if(oItem.state == 3){
            oItem.stateName = '计票中心计票';
        }else{
            oItem.stateName = '未投票';
        }
        if(oItem.state == -1){
            oItem.opt += '<button type="button" class="btn btn-md btn-primary" onclick="toVote(\''+oItem.id+'\')"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;投票</button>';
        }
    };
    //表格渲染完成后的回调,参数为表格数据(数组对象)
    joView.setGridDataAfter = function(oList){

    };
    //去投票
    function toVote(id){
        if(!id){
            return;
        }
        jo.showWin('/page/vote/goVoteForm.html?id=' + id, '70%', '70%', '投票', 'WIN_GO_VOTE');
    }
    /* 关于joView更多回调函数和配置参数可查看jo-page-view.js */
</script>
</body>
</html>
